package sfunc

import (
	"fmt"
	"os"
	"time"
)

//错误提示
func ErrCheck(tips string, err error) {
	if err != nil {
		fmt.Printf("错误信息 : %s.\r\n", tips, err)
		os.Exit(-1)
	}
}

//时间转时间戳
func ToTimestamp(format string, value string) int64 {
	local, _ := time.LoadLocation("Asia/Shanghai")
	tm, _ := time.ParseInLocation(format, value, local)
	return tm.Unix()
}

//时间戳转时间
func ToDatetime(format string, value int64) string {
	return time.Unix(value, 0).Format(format)
}


